from typing import Optional, Any

import scrapy
from env import logger

class VjudgeSpider(scrapy.Spider):
    name = "vjudge"
    allowed_domains = ["vjudge.net.cn"]
    start_urls = ["https://vjudge.net.cn/"]

    custom_settings = {
        'ITEM_PIPELINES': {'crawl.pipelines.VjudgePipeline': 400, },
    }

    def start_requests(self):
        match self.opt:
            case "race":
                url = self.base_url + "acm/contest/vip-index"
                logger.info(f"url:{url}")
                yield scrapy.Request(url, callback=self.race_parse)  # 指定回调函数,否则默认回调parse函数

    def race_parse(self, response):
        pass
